package io.renren.wh.channel.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.wh.channel.entity.ChannelCashEntity;
import io.renren.wh.channel.service.ChannelCashService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author 夏沫止水
 * @email HeJieLin@gulimall.com
 * @date 2020-07-21 16:48:41
 */
@RestController
@RequestMapping("wh/channelcash")
public class ChannelCashController {
    @Autowired
    private ChannelCashService channelCashService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions(":channelcash:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = channelCashService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions(":channelcash:info")
    public R info(@PathVariable("id") Integer id){
		ChannelCashEntity channelCash = channelCashService.getById(id);

        return R.ok().put("channelCash", channelCash);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions(":channelcash:save")
    public R save(@RequestBody ChannelCashEntity channelCash){
		channelCashService.save(channelCash);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions(":channelcash:update")
    public R update(@RequestBody ChannelCashEntity channelCash){
		channelCashService.updateById(channelCash);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions(":channelcash:delete")
    public R delete(@RequestBody Integer[] ids){
		channelCashService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
